






//
//  DealFangModel.m
//  房源、商铺、写字楼详情页
//
//  Created by MB__Lee on 2018/5/23.
//  Copyright © 2018年 MB__Lee. All rights reserved.
//

#import "DealFangModel.h"
#import "NSString+CaculateLenght.h"

#import "FourthDetail.h"

@implementation DealFangModel

-(void)setModel:(MBFangDetailModel *)model{
    
    _model = model;
    
    self.firstHight = [self caculateFirstHight];     // 标题
    self.secondHight = 84;    // 房租、类型、面积
    self.thirdHight = 175 + 30;   //  方式、时间、装修、楼层、编号、区域
  
    
//    FourthDetail *fourModel = [[FourthDetail alloc] init];
//    CGFloat height = [fourModel creatLabelAndMakeFrameWithArray:model.subsidiary];
//    self.fourthHight = height + 30 + MBScale(10);

    //优势
    self.fourthHight = 115;
    
    
    self.fifthHight = 115;   //发布人
    
    // 配套设施
    if ([model.category isEqualToString:@"1001"]) {
        self.sixHight = 190;
    }else{
        self.sixHight = 0;
    }
    
    
    self.seventhHight = [self caculateSixHight];  //房源描述
    self.eightHight = 235;   //周边及交通
    self.nithHight = 256;      //推荐房源
    
    
    
}
-(CGFloat)caculateFirstHight{
    CGFloat hight = [_model.title heightForStringFontSize:MBFont(22) width:SCREEN_WIDTH-30];
    return  hight + 50;
    
}

-(CGFloat)caculateSixHight{
    CGFloat width =  SCREEN_WIDTH - 30;
    
    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    //调整行间距
    paragraphStyle.lineSpacing = 7;
    NSDictionary *dic= @{NSParagraphStyleAttributeName:paragraphStyle};
    CGFloat height  = [_model.describe heightForStringFontSize:MBFont(14) width:width dict:dic];
    
    return  height + 100;
}

@end
